<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('出款冻结数据')" />
</head>
<body class="gray-bg">
<div class="container-div">
	<div class="row">
		<div class="col-sm-12 search-collapse">
			<form id="formId">
				<div class="select-list">
					<input type="hidden" name="balances_status" value="-3">
					<input type="hidden" name="type" value="0">
					<ul>
						<li>
							<label>商户编号：</label>
							<input type="text" name="merno"/>
						</li>
						<li>
							<label>结算卡号：</label>
							<input type="text" name="screen_num"/>
						</li>
						<li>
							<label style="width: 80px">出款流水号：</label>
							<input type="text" name="balances_serial"/>
						</li>
						<li>
							<label>商户类别：</label>
							<select name="mer_category">
								<option value="">请选择</option>
								<option value="0">标准类</option>
								<option value="1">优惠类</option>
								<option value="2">减免类</option>
							</select>
						</li>
						<li>
							<label>商户类型：</label>
							<select name="mer_type">
								<option value="">请选择</option>
								<option value="0">传统商户</option>
								<option value="1">手刷商户</option>
							</select>
						</li>
						<li>
							<label>订单编号：</label>
							<input type="text" name="ordernumber"/>
						</li>
						<li>
							<label>账户名称：</label>
							<input type="text" name="screen_name"/>
						</li>
						<li>
							<label style="width: 80px;">结算类型：</label>
							<select name="settle_type">
								<option value="">请选择</option>
								<option value="00">商户</option>
								<option value="01">代理</option>
							</select>
						</li>
						<li class="select-time">
							<label >日期：</label>
							<input type="text" class="time-input" id="startTime" placeholder="开始时间" name="mindDate"/>
							<span>-</span>
							<input type="text" class="time-input" id="endTime" placeholder="结束时间" name="maxDate"/>
						</li>
						<li>
							<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
							<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
						</li>
					</ul>
				</div>
			</form>
		</div>
		<div class="btn-group-sm" id="toolbar" role="group">
			<a class="btn btn-success" onclick="saveThawStatus()" shiro:hasPermission="settleInfo:settleInfo:saveThawStatus">
				<i class="fa fa-edit"></i> 出款解冻
			</a>
		</div>

		<div class="col-sm-12 select-table table-striped">
			<table id="bootstrap-table"></table>
		</div>
	</div>
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
	var prefix = ctx + "settleInfo/settleInfo";

	$(function()  {
		var options = {
			url: prefix + "/forzenPayList",
			showSearch: false,
			showRefresh: false,
			showToggle: false,
			showColumns: false,
			clickToSelect:true,
			columns: [
				{
					checkbox: true
				},
				{
					field : 'MERNO',
					title : '商户编号',
					width: "180",
					formatter:function (value, row, index) {
						return value+$.table.tooltip('[备注]'+row.REMARKS,4);
					}
				},
				{
					field : 'MER_NAME',
					title : '商户名称',
					formatter:function (value, row, index) {
						return $.table.tooltip(value,4);
					}
				},
				{
					field : 'MER_CATEGORY',
					title : '商户类别',
					formatter: function(value, row, index) {
						if ("0"==value){
							return '<span style="color:blue;">标准类</span>';
						}else if("1"==value){
							return '<span style="color:green;">优惠类</span>';
						}else if("2"==value){
							return '<span style="color:green;">减免类</span>';
						}else{
							return '<span style="color:red;">未知</span>';
						}
					}
				},
				{
					field : 'MER_TYPE',
					title : '商户类型',
					formatter: function(value, row, index) {
						if ("0"==value){
							return '<span style="color:blue;">传统商户</span>';
						}else if("1"==value){
							return '<span style="color:green;">手刷商户</span>';
						}else{
							return '<span style="color:red;">未知</span>';
						}
					}
				},
				{
					field : 'NATURE',
					title : '账户类型',
					formatter: function(value, row, index) {
						if ("1"==value){
							return '<span style="color:blue;">对公</span>';
						}else if("2"==value){
							return '<span style="color:green;">对私</span>';
						}else{
							return '<span style="color:red;">未知</span>';
						}
					}
				},
				{
					field : 'BANK_NAME',
					title : '开户行名称',
					formatter:function (value, row, index) {
						return $.table.tooltip(value,4);
					}
				},
				{
					field : 'SCREEN_NAME',
					title : '结算人'
				},
				{
					field : 'SHOW_SCREENNUM',
					title : '结算卡'
				},
				{
					field : 'TMONEY',
					title : '结算金额(元)',
					formatter: function(value, row, index) {
						return $.table.rmbFormatter(value);
					}
				},
				{
					field : 'AMOUNT',
					title : '总交易金额(元)',
					formatter: function(value, row, index) {
						return $.table.rmbFormatter(value);
					}
				},

				{
					field : 'CHARGE',
					title : '总手续费(元)',
					formatter: function(value, row, index) {
						return $.table.rmbFormatter(value);
					}
				},
				{
					field : 'COUNTS',
					title : '总笔数'
				},
				{
					field : 'AUDITDATE',
					title : '出款日期'
				},
				{
					field : 'SETTLE_STATE',
					title : '出款状态',
					formatter: function(value, row, index) {
						if ("0"==value){
							return '<span style="color:blue;">待处理</span>';
						}else if("1"==value){
							return '<span style="color:green;">出款成功</span>';
						}else if("-2"==value){
							return '<span style="color:green;">出款失败</span>';
						}else if("-3"==value){
							return ' <span style="color:green;">冻结</span>';
						}else if("1"==value){
							return ' <span style="color:green;">已上送</span>';
						}else{
							return ' <span style="color:red;">出款失败</span>';
						}
					}
				},

				{
					field : 'SETTLE_SERIAL',
					title : '出款流水号'
				},]
		};
		$.table.init(options);
	});

	/**
	 * 出款解冻
	 */
	function saveThawStatus() {
		$.modal.confirm("确认解冻吗?", function() {
			var arrays = $.table.selectColumns("ID");
			if ($.common.isEmpty(arrays)){
				$.modal.msgError("请至少选择一条记录");
				return;
			}
			var data = {"ids":arrays.toString()};
			$.operate.submit(prefix + "/saveThawStatus", "post", "json",data);
		});
	}


</script>
</body>
</html>